-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle valid JSON messages which are not GreengrassLogMessages #214
Conversation
867b165
to
55b0f0d
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #214 +/- ##
==========================================
- Coverage 86.35% 85.36% -0.99%
==========================================
Files 13 13
Lines 1033 1052 +19
Branches 106 109 +3
==========================================
+ Hits 892 898 +6
- Misses 87 96 +9
- Partials 54 58 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Unit Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 73b73c7 |
Integration Tests Coverage Report
Minimum allowed coverage is Generated by 🐒 cobertura-action against 73b73c7 |
String totalLogNumbers = "50"; | ||
String fileSizeBytes = "1024"; | ||
String fileSizeUnit = "KB"; | ||
String componentName = "com.aws.greengrass.artifacts.LogGenerator"; | ||
String activeFileName = logFileName + "." + logFileExtention; | ||
String activeFileName = logFileName + ".log"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we moving from a variable to a hard coded string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a test (for a test), variable wasn't a variable but a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit about the ".log" string
src/test/java/com/aws/greengrass/logmanager/CloudWatchAttemptLogsProcessorTest.java
Outdated
Show resolved
Hide resolved
2ee0833
to
73b73c7
Compare
@@ -17,19 +16,18 @@ public class LogGeneratorTest { | |||
@TempDir | |||
static Path tempPath; | |||
String logFileName = "localtest"; | |||
String logFileExtention = "log"; | |||
String logWriteFreqSeconds = "0.1"; | |||
String logWriteFreqMs = "100"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is someone going to think this is milliseconds and not messages per second?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is milliseconds. 0.1 seconds is 100 milliseconds.
Issue #, if available:
#213
Description of changes:
Handle the case where log level is null in deserialized JSON format logs. Log level is never supposed to be null, so this should only be possible if someone is not using the Greengrass logger (waiting for more customer info to determine this). Regardless, we should handle the case properly. Here we default to INFO level if the log level parsed from JSON is null or empty.
Why is this change necessary:
How was this change tested:
Updated existing test file with a null log level and verified that test fails without the fix and that it passes with the fix.
Any additional information or context required to review the change:
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.